class CreateRuleTables < ActiveRecord::Migration
  def self.up
    begin 
    rules_up()
    rescue
      puts "Failed to bring in the Rules: " + $!
    end
  end

  def self.down
    begin drop_table :rules       rescue puts "Failed to drop: " + $! end
    begin drop_table :violations  rescue puts "Failed to drop: " + $! end
    begin drop_table :laws        rescue puts "Failed to drop: " + $! end
    begin drop_table :guidelines  rescue puts "Failed to drop: " + $! end
    begin drop_table :rule_sets   rescue puts "Failed to drop: " + $! end
  end

  def self.rules_up
    create_table :rules do |t|
      t.string :name

      t.timestamps
    end

    create_table :laws do |t|

      t.timestamps
    end

    create_table :guidelines do |t|

      t.timestamps
    end

    create_table :rule_sets do |t|
      t.timestamps
    end

    #Might want to be elsewhere?
    create_table :violations do |t|
      t.timestamps
    end
  end
end
